import request from '../utils/request'

// 站内用户获取收藏夹
export function getFavorite(uid) {
    return request({
        url: '/user/favorite/get-all/user',
        method: 'get',
        params: {
            uid : uid
        }
    })
}

// 游客获取收藏夹
export function visitorGetFavorite(uid) {
    return request({
        url: '/user/favorite/get-all/visitor',
        method: 'get',
        params: {
            uid : uid
        }
    })
}


// 添加收藏夹
export function addFavorite(fromData) {
    return request({
        url: '/user/favorite/create',
        method: 'post',
        data: fromData
    })
}

export function getVideoByFavorite(fid, rule, page, quantity) {
    return request({
        url: '/user/video/favorite',
        method: 'get',
        params: {
            fid : fid,
            rule : rule,
            page : page,
            quantity : quantity
        }
    })
}

export function cancelFavorite(vid, fid) {
    return request({
        url: '/user/video/favorite',
        method: 'get',
        params: {
            vid : vid,
            fid : fid
        }
    })
}

// 收藏或取消收藏某视频
export function collectVideo(vid, adds, removes) {
    return request({
        url: '/user/favorite/video/collect',
        method: 'post',
        params: {
            vid : vid,
            adds : adds,
            removes : removes
        }
    })
}

// 获取收藏了某视频的收藏夹ID列表
export function getUserCollectedFids(vid) {
    return request({
        url: '/user/favorite/video/collected-fids',
        method: 'get',
        params: {
            vid : vid,
        }
    })
}

